package com.share.dubbo.wssh.service.impl;

import com.share.common.common.Page;
import com.share.common.common.Result;
import com.share.dubbo.ssm.model.AccessLogPageListReq;
import com.share.dubbo.ssm.model.AccessLogPageListResp;
import com.share.dubbo.ssm.model.AccessLogSaveReq;
import com.share.dubbo.ssm.service.AccessLogService;
import com.share.dubbo.wssh.model.LogPageReq;
import com.share.dubbo.wssh.model.LogReq;
import com.share.dubbo.wssh.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class LogServiceImpl implements LogService {
    /*使用dubbo注解引入*/
    @Reference
    private AccessLogService accessLogService;

    @Override
    public int insert(LogReq req) {
        AccessLogSaveReq record = new AccessLogSaveReq();
        BeanUtils.copyProperties(req, record);
        Result<Integer> result = accessLogService.insert(record);
        return result.getData();
    }

    @Override
    public Page pageList(LogPageReq req) {
        AccessLogPageListReq record = new AccessLogPageListReq();
        BeanUtils.copyProperties(req, record);
        Result<Page<AccessLogPageListResp>> result = accessLogService.pageList(record);
        return result.getData();
    }
}
